using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using ZO.SmartCore.Windows.Forms.Design;

namespace ZO.SmartCore.Windows.Forms
{
    /// <summary>
    /// A Header Control used to display descripton about current operation
    /// </summary>
    [Designer(typeof(SmartHeaderDesigner))]
    [ToolboxBitmap(typeof(SmartHeader), "SmartCore.Windows.Forms.SmartHeader.bmp")]
    [ToolboxItem(true)]
    public partial class SmartHeader : SmartUserControl
    {


        /// <summary>
        /// Initializes a new instance of the <see cref="SmartHeader"/> class.
        /// </summary>
        public SmartHeader()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Get/Set the title for the wizard page
        /// </summary>
        [Category("Appearance")]
        [DefaultValue("Title")]
        public string Title
        {
            get
            {
                return TitleLabel.Text;
            }
            set
            {
                TitleLabel.Text = value;
            }
        }

        /// <summary>
        /// Gets/Sets the
        /// </summary>
        [Category("Appearance")]
        [DefaultValue("Description")]
        public string Description
        {
            get
            {
                return DescriptionLabel.Text;
            }
            set
            {
                DescriptionLabel.Text = value;
            }
        }

        /// <summary>
        /// Gets/Sets the Logo
        /// </summary>
        [Category("Appearance")]
        public Image Logo
        {
            get
            {
                return LogoPictureBox.Image;
            }
            set
            {
                LogoPictureBox.Image = value;

                LogoPictureBox.Visible = (LogoPictureBox.Image == null) ? false : true;
            }
        }

        /// <summary>
        /// Gets or sets the background color for the control.
        /// </summary>
        /// <value></value>
        /// <returns>A <see cref="T:System.Drawing.Color"></see> that represents the background color of the control. The default is the value of the <see cref="P:System.Windows.Forms.Control.DefaultBackColor"></see> property.</returns>
        /// <PermissionSet><IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true"/></PermissionSet>
        [DefaultValue(typeof(Color), "White")]
        public override Color BackColor
        {
            get
            {
                return ContentPanel.BackColor;
            }
            set
            {
                ContentPanel.BackColor = value;
            }
        }

        /// <summary>
        /// Gets or sets the background image displayed in the control.
        /// </summary>
        /// <value></value>
        /// <returns>An <see cref="T:System.Drawing.Image"></see> that represents the image to display in the background of the control.</returns>
        /// <PermissionSet><IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true"/></PermissionSet>
        public override Image BackgroundImage
        {
            get
            {
                return ContentPanel.BackgroundImage;
            }
            set
            {
                ContentPanel.BackgroundImage = value;
            }
        }

  

        /// <summary>
        /// Gets or sets the background image layout as defined in the <see cref="T:System.Windows.Forms.ImageLayout"></see> enumeration.
        /// </summary>
        /// <value></value>
        /// <returns>One of the values of <see cref="T:System.Windows.Forms.ImageLayout"></see> (<see cref="F:System.Windows.Forms.ImageLayout.Center"></see> , <see cref="F:System.Windows.Forms.ImageLayout.None"></see>, <see cref="F:System.Windows.Forms.ImageLayout.Stretch"></see>, <see cref="F:System.Windows.Forms.ImageLayout.Tile"></see>, or <see cref="F:System.Windows.Forms.ImageLayout.Zoom"></see>). <see cref="F:System.Windows.Forms.ImageLayout.Tile"></see> is the default value.</returns>
        /// <exception cref="T:System.ComponentModel.InvalidEnumArgumentException">The specified enumeration value does not exist. </exception>
        /// <PermissionSet><IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true"/></PermissionSet>
        public override ImageLayout BackgroundImageLayout
        {
            get
            {
                return ContentPanel.BackgroundImageLayout;
            }
            set
            {
                ContentPanel.BackgroundImageLayout = value;
            }
        }



        /// <summary>
        /// Shoulds the serialize logo.
        /// </summary>
        /// <returns></returns>
        private bool ShouldSerializeLogo()
        {
            return LogoPictureBox.Image != ((Image)(resources.GetObject("LogoPictureBox.Image")));
        }

        /// <summary>
        /// Resets the logo.
        /// </summary>
        private void ResetLogo()
        {
            LogoPictureBox.Image = ((Image)(resources.GetObject("LogoPictureBox.Image")));
        }

    }
}
